package global

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

const (
	CodeSuccess      = 200
	CodeTokenIllegal = 403
	CodeNotFound     = 404
	CodeIllegalParam = 405

	MsgSuccess      = "请求成功"
	MsgTokenIllegal = "非法token"
	MsgNotFound     = "访问的资源不存在"
)

// BaseResp is Server returns data based model
type BaseResp struct {
	Code int         `json:"code" example:"200"`
	Msg  string      `json:"msg" example:"请求成功/失败"`
	Data interface{} `json:"data"`
}

//NotFoundError response access resource does not exist
func NotFoundError(c *gin.Context) {
	c.JSON(http.StatusOK, BaseResp{Code: CodeNotFound, Msg: MsgNotFound})
}